<template>
  <div class="left-chart-1">
    <div class="lc1-header">小易系统监控</div>
    <dv-scroll-board :config="config" style="width:100%;height:100%" />
    <dv-decoration-2 style="height:10px;" />
  </div>
</template>

<script>
import { getXyMetrics } from "@/api/metrics"
export default {
  name: 'LeftChart1',
  data: function () {
    return {
      config: {
        data: []
      }
    }
  },
  mounted () {
    this.loadData()
    // eslint-disable-next-line no-unused-vars
    this.timer = setInterval(this.loadData, 1000 * 60)
  },
  beforeDestroy () {
    clearInterval(this.timer)
  },
  methods: {
    loadData: function () {
      getXyMetrics().then(res => {
          this.config = {
            data: res.data.xyMetrics,
            header: ['模块', 'IP', '协程', '文件数', '状态'],
            align: ['left'],
            rowNum: 8,
            headerBGC: '#061423',
            columnWidth: [110, 75, 86, 80, 65],
            headerHeight: 50,
            oddRowBGC: 'rgba(4,18,29,0.8)',
            evenRowBGC: 'rgb(5,40,73)',
            carousel: 'page',
            waitTime: '4000'
          }// this.data = res
        })
        .catch(function (res) {
          console.log(res)
        })
    }
  }
}
</script>

<style lang="less">
.left-chart-1 {
  width: 100%;
  height: 35%;
  display: flex;
  flex-grow: 0;
  flex-direction: column;

.lc1-header {
  text-align: center;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  margin-bottom: 10px;
}

.lc1-details {
  height: 50px;
  font-size: 16px;
  display: flex;
  align-items: center;
  text-indent: 20px;

span {
  color: #096dd9;
  font-weight: bold;
  font-size: 35px;
  margin-left: 20px;
}
}

.lc1-chart {
  flex: 1;
}
}
</style>
